home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # Address Book startup script.
- #
- # @(#)showmeab.sh 1.6 96/02/26 Copyright 1993-94 Sun Microsystems, Inc. All Rights Reserved.
- #
-
-
- #
- # Where various components of this application live.
- #
- ShowMeHome=
- showmeHome=
- utilsHome=
- helpHome=
- motifHome=
-
- helpExecDir=
- showmeExecDir=
- machDepExecDir=
-
- osVersion=
-
-
- programName=$0
-
-
- #
- # If a path name is a symbolic link, resolve it.
- #
- GetRealPath()
- {
- pathName="$1"
- level=1
-
-
- while [ -h "$pathName" ] ; do
-
- level=`/bin/expr $level + 1`
- if [ $level -gt 10 ] ; then
- echo "$pathName: too many levels of symbolic links"
- break;
- fi
-
- #
- # First, make sure we have an absolute path name.
- #
- if IsRelativePath "$pathName" ; then
- pathName=`/bin/pwd`/"$pathName"
- fi
-
- #
- # Then determine where the link points (via "ls -l")
- #
- dirName=`/bin/dirname $pathName`
- link=`/bin/ls -l $pathName | sed -e 's,.* -> ,,g'`
-
- if IsRelativePath "$link" ; then
- pathName="$dirName"/"$link"
- else
- pathName="$link"
- fi
- done
-
- echo "$pathName"
-
- return 0
- }
-
-
- #
- # Is this a relative path name (i.e., doesn't begin with "/")?
- #
- IsRelativePath()
- {
- pathName="$1"
-
- if [ `echo "$pathName" | sed -e 's,^/.*,absolute,g'` = "absolute" ] ; then
- return 1
- else
- return 0
- fi
- }
-
-
- #
- # Determine what version of Solaris we're running
- #
- GetOSVersion()
- {
- OS=`/bin/uname -r`
-
- case $OS in
- 4.*) osVersion=SUNOS;;
- 5.*) case `/bin/uname -p` in
- sparc)
- osVersion=SVR4;;
- *86)
- osVersion=I386;;
- esac;;
- A.*)
- osVersion=HPUX;;
- esac
-
- }
-
-
- #
- # Determine where ShowTV lives.
- # We assume that it's two levels up above the directory containing
- # this script.
- #
- GetPaths()
- {
- tmpDir=`GetRealPath $programName`
- tmpDir=`dirname $tmpDir`
- ShowMeHome=`( cd $tmpDir/../.. && /bin/pwd )`
-
- showmeHome=$ShowMeHome/ShowMeTV
- utilsHome=$ShowMeHome/utilities
- helpHome=$ShowMeHome/help
- motifHome=$ShowMeHome/motif
- }
-
-
- #
- # Set up ShowTV environment.
- #
- SetupEnvironment()
- {
- helpExecDir=$helpHome/bin
- HHPATH=$utilsHome/share ; export HHPATH
-
- showmeExecDir=$showmeHome/bin
- machDepExecDir=$showmeExecDir/bin-$osVersion
- utilsExecDir=$utilsHome/bin/bin-$osVersion
- sunsolBinDir=`dirname $0`
-
-
- #
- # Add ShowTV and HyperHelp executable directories to shell search path
- #
- PATH=${showmeExecDir}:${machDepExecDir}:${utilsExecDir}:${helpExecDir}:${sunsolBinDir}:${PATH}
-
- export PATH
-
- #
- # Use our own Motif key_bindings because the built-in ones
- # in the Motif library don't handle all the Sun keys correctly.
- # However, if XMBINDDIR is already set, leave it alone!
- #
-
- if [ -d ${motifHome}/share/key_bindings ]; then
- XMBINDDIR=${XMBINDDIR:=${motifHome}/share/key_bindings}
- export XMBINDDIR
- fi
- }
-
-
- #
- # Update loader search path as necessary.
- #
- SetLibraryPath()
- {
- motifLibDir=$motifHome/lib-$osVersion
-
- [ -d $motifLibDir ] || {
- echo "Sorry, can't run ShowTV - the Motif shared library is missing."
- exit 1
- }
-
- #
- # Setup Motif environment variables for SUNOS
- #
- if [ $osVersion = "SUNOS" ] ; then
- XLIBDIR=$motifLibDir
- export XLIBDIR
- XLIBI18N_PATH=$motifLibDir/X11
- export XLIBI18N_PATH
- XKEYSYMDB=$motifLibDir/X11/XKeysymDB
- export XKEYSYMDB
- fi
-
- # On 4.x systems, we are required to set LD_LIBRARY_PATH
- # On 5.2 and 5.3 systems, we must set it to pick up the patched libXt
-
- #
- # Prepend the ShowTV specific X and Motif library directory,
- # followed by the regular Sun OpenWindow library directory.
- #
- openwinHome=${OPENWINHOME:-/usr/openwin}
-
- case $OS in
- 4.*)
- LD_LIBRARY_PATH=${motifLibDir}:${openwinHome}/lib:${LD_LIBRARY_PATH};;
- 5.[23])
- LD_LIBRARY_PATH=${motifLibDir}:${motifLibDir}/patched-libs,5.2:${openwinHome}/lib:${LD_LIBRARY_PATH};;
- *)
- LD_LIBRARY_PATH=${motifLibDir}:${openwinHome}/lib:${LD_LIBRARY_PATH};;
- esac
-
- export LD_LIBRARY_PATH
- }
-
-
- ####################################################
-
- GetOSVersion
-
- GetPaths
-
- SetupEnvironment
-
- # We now use /usr/dt/lib for motif library. Don't need to set up environment
- # to look for stuff in /opt/SUNWsunsol/motif
- # SetLibraryPath
-
- #
- # Cleanup Motif key bindings
- #
- #
- #if [ -x ${motifHome}/lib-${osVersion}/bin/delbind_util ]; then
- # ${motifHome}/lib-${osVersion}/bin/delbind_util $*
- #fi
-
-
- echo "Starting Address Book"
- exec $utilsExecDir/`basename $0` $@
-
- exit 0
-